Interview-1

 How can import data from particular row or column?

sqoop import –connect jdbc:mysql://db.one.com/corp --table EMP --where "start_date> ’2016-07-20"

sqoopeval --connect jdbc:mysql://db.test.com/corp --query "SELECT * FROM intellipaat_emp LIMIT 20"

sqoop import –connect jdbc:mysql://localhost/database --username root --password aaaaa –columns "name,emp_id,jobtitle"

 How can we can control the number of mappers?

-m -num-mappers 

How will you updates the rows that are already exported?

By using the parameter – update-key we can update existing rows. Comma-separated list of columns is used which uniquely identifies a row. All of these columns are used in the WHERE clause generated UPDATE query. All other table columns will be used in the SET part of the query.

How you list all the columns of a table using Apache Sqoop?

Sqoop import –m1 –connect 'jdbc:sqlserver://servername;database=databasename; Username-root;password=mypassword' –query "SELECT column_name,DATA_TYPE FROM INFORMATION_SCHEMA columns  WHERE table_name='mytableofinterest' AND \$CONDITIONS" –target-dir 'column_name'

Mentioned the best features of Apache Sqoop.

Apache Sqoop is a tool in Hadoop ecosystem have several advantages. Like

  1. Parallel import/export
  2. Connectors for all major RDBMS Databases
  3. Import results of SQL query
  4. Incremental Load
  5. Full Load
  6. Kerberos Security Integration
  7. Load data directly into Hive / HBase
  8. Compression
  9. Support for Accumulo
What is default file format in Apache Sqoop to import data.
Sqoop allows data to be imported using two file formats
i) Delimited Text File Format
This is the default file format to import data using Sqoop. This file format can be explicitly specified using the –as-textfile argument to the import command in Sqoop. Passing this as an argument to the command will produce the string based representation of all the records to the output files with the delimited characters between rows and columns.

ii) Sequence File Format
It is a binary file format where records are stored in custom record-specific data types which are shown as Java classes. Sqoop automatically creates these data types and manifests them as java classes.

No comments:

Post a Comment